package com.tjsinfo.tjsoa.worklog.action;

import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.tjsinfo.tjsoa.worklog.bo.IWorkLogMainBo;
import com.tjsinfo.tjsoa.worklog.vo.WorkLogMain;
import com.tjsinfo.tjsoa.system.vo.TSystemUser;
import com.tjsinfo.tjsoa.system.vo.User;

public class CheckDefalntWorkLogDateModleAction extends WorkLogDateModleAction{
private IWorkLogMainBo workLogMainBo;

	
	public IWorkLogMainBo getWorkLogMainBo() {
	return workLogMainBo;
}


public void setWorkLogMainBo(IWorkLogMainBo workLogMainBo) {
	this.workLogMainBo = workLogMainBo;
}


/* (non-Javadoc)
 * @see com.tjsinfo.tjsoa.worklog.action.WorkLogDateModleAction#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
 */
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response)
		throws Exception {
	// TODO Auto-generated method stub
	Date date = new Date();
	User user = new User();
	TSystemUser tjsuser = getDefinalutTjsuser(request, user);
	request.setAttribute("tjsuser", tjsuser);
	request.setAttribute("userinfoid", Integer.parseInt(request.getParameter("id")));
	Map<Date, WorkLogMain> worklogmap = getMap(date, user,"D", 1);
	request.setAttribute("worklogmap", worklogmap);
	
	request.setAttribute("yueli", date);
	
	return findforward(mapping);
}




	protected Map<Date, WorkLogMain> getMap(Date date, User user,String type,Integer start) {
		Map<Date, WorkLogMain> worklogmap =   workLogMainBo.selectDefantWorkLogDate(type, date.getYear() +1900, user.getUser_id(), start);
		return worklogmap;
	}
}
